package com.common;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class JsonResponse {
    private Object data;
    private String code;
    private String msg;

    public static JsonResponse success(Object data){
        return new JsonResponse(data, "200", "处理成功");
    }

    public static JsonResponse success(Object data, String msg){
        return new JsonResponse(data, "200", msg);
    }

    public static JsonResponse error(Object data){
        return new JsonResponse(data, "500", "处理错误");
    }
    public static JsonResponse error(Object data, String msg){
        return new JsonResponse(data, "500", msg);
    }
}
